<?php
namespace app\controllers\api;

use PHPQRCode\Constants;
use PHPQRCode\QRcode;
use Yii;
use yii\web\Controller;

class QrcodeController extends Controller
{
    public function actionUrl()
    {
        $content = Yii::$app->request->get('url');
        $headers = Yii::$app->getResponse()->getHeaders();
        $headers['Content-Type'] = 'image/png';
        QRcode::png($content, false, Constants::QR_ECLEVEL_M, 9, 1);
    }

}